/**
 * Created by 66xiaoqu on 2015/12/31.
 */
var apiService = require('../../../services/mis/system/apiService');
var messageUtil = require('../../../common/utils/messageUtil');
var toolUtil = require('../../../common/utils/toolUtil');

exports.apiList = function (req, res) {

    apiService.apiTimeCategoryService(req, function (err, results) {

        if (err) {
            logger.error('Exception happen when exchangeListService...' + err.message);
            res.json(messageUtil.composeFailedMessage(req, 'Exception happen when apiTimeCategory...'));
        } else {
            var data = {
                count: results[0]["count"],
                totalPage: results[0]["totalPage"],
                list: results[1]
            };
            res.json(messageUtil.composeSucceededMessage(req, null, data));
        }
    });
};

//exports.apiRankList = function (req, res) {
//    apiService.apiTimeRankService(req, function (err, results) {
//
//        if (err) {
//            logger.error('Exception happen when exchangeListService...' + err.message);
//            res.json(messageUtil.composeFailedMessage(req, 'Exception happen when apiRankList...'));
//        } else {
//            var data = {
//                count: results[0]["count"],
//                totalPage: results[0]["totalPage"],
//                list: results[1]
//            };
//            res.json(messageUtil.composeSucceededMessage(req, null, data));
//        }
//    });
//}

exports.apiCodeList = function (req, res) {
    apiService.apiCodeCategoryService(req, function (err, results) {

        if (err) {
            logger.error('Exception happen when exchangeListService...' + err.message);
            res.json(messageUtil.composeFailedMessage(req, 'Exception happen when apiTimeCategory...'));
        } else {
            var data = {
                count: results[0]["count"],
                totalPage: results[0]["totalPage"],
                list: results[1]
            };
            res.json(messageUtil.composeSucceededMessage(req, null, data));
        }
    })
};